/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package textfilewriter.entity.fact;

import java.text.SimpleDateFormat;
import textfilewriter.entity.dimension.Customer;
import java.util.Date;

/**
 *
 * @author GiangLT
 */
public class EcommerceAnalysis {

    private Date startDate;
    private Date endDate;
    private int hour;
    private String network;
    private String portalUrl;
    private Customer customer;
    private double revenue;
    private String productBought;
    private int numOfUsers;
    private int ecommerceUserPerc;

    public EcommerceAnalysis() {
    }

    public Customer getCustomer() {
        return customer;
    }

    public void setCustomer(Customer customer) {
        this.customer = customer;
    }

    public int getEcommerceUserPerc() {
        return ecommerceUserPerc;
    }

    public void setEcommerceUserPerc(int ecommerceUserPerc) {
        this.ecommerceUserPerc = ecommerceUserPerc;
    }

    public Date getEndDate() {
        return endDate;
    }

    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }

    public int getHour() {
        return hour;
    }

    public void setHour(int hour) {
        this.hour = hour;
    }

    public String getNetwork() {
        return network;
    }

    public void setNetwork(String network) {
        this.network = network;
    }

    public int getNumOfUsers() {
        return numOfUsers;
    }

    public void setNumOfUsers(int numOfUsers) {
        this.numOfUsers = numOfUsers;
    }

    public Date getStartDate() {
        return startDate;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    public String getPortalUrl() {
        return portalUrl;
    }

    public void setPortalUrl(String portalUrl) {
        this.portalUrl = portalUrl;
    }

    public String getProductBought() {
        return productBought;
    }

    public void setProductBought(String productBought) {
        this.productBought = productBought;
    }

    public double getRevenue() {
        return revenue;
    }

    public void setRevenue(double revenue) {
        this.revenue = revenue;
    }

    @Override
    public String toString() {
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        StringBuilder sb = new StringBuilder();
        sb.append(dateFormat.format(startDate));
        sb.append("|");
        sb.append(dateFormat.format(endDate));
        sb.append("|");
        sb.append(customer.getCustFirstName());
        sb.append(" ");
        sb.append(customer.getCustLastName());
        sb.append("|");
        sb.append(customer.getCustStreetAddress());
        sb.append("|");
        sb.append(customer.getCustEmail());
        sb.append("|");
        sb.append(customer.getMsisdn());
        sb.append("|");
        sb.append(portalUrl);
        sb.append("|");
        sb.append(network);
        sb.append("|");
        sb.append(revenue);
        sb.append("|");
        sb.append(productBought);

        return sb.toString();
    }

    public String getHeader() {
        return "Start date|End date|Customer name|Customer Adress|Customer Email|MSISDN|Portal|Network|Revenue|Product Bought";
    }
}
